package com.interview.checkinfo.repository;

import java.util.Date;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

import com.interview.checkinfo.entity.CheckInfo;
import com.interview.checkinfo.entity.CheckInfo_;
import com.interview.employeeInfo.entity.EmployeeInfo;

public class CheckInfoRepositoryImpl  {

	@PersistenceContext
	EntityManager entityManager;
	

//	@Override
//	public List<CheckInfo> findByEmployeeInfo(EmployeeInfo employeeInfo) {
//
//		CriteriaBuilder cb = entityManager.getCriteriaBuilder();
//
//		CriteriaQuery<CheckInfo> cq = cb.createQuery(CheckInfo.class);
//		Root<CheckInfo> root = cq.from(CheckInfo.class);
//		Predicate p = cb.equal(root.get(CheckInfo_.employeeInfo), employeeInfo);
//		cq.where(p);
//
//		TypedQuery<CheckInfo> tye = entityManager.createQuery(cq);
//		List<CheckInfo> checkInfoes = tye.getResultList();
//		return checkInfoes;
//
//	}
//
//	@Override
//	public List<CheckInfo> findByDate(Date star, Date end) {
//
//		CriteriaBuilder cb = entityManager.getCriteriaBuilder();
//		CriteriaQuery<CheckInfo> cq = cb.createQuery(CheckInfo.class);
//		Root<CheckInfo> root = cq.from(CheckInfo.class);
//		Predicate p = cb.between(root.get(CheckInfo_.createdTime), star, end);
//		cq.where(p);
//		TypedQuery<CheckInfo> tye = entityManager.createQuery(cq);
//		List<CheckInfo> checkInfoes = tye.getResultList();
//
//		return checkInfoes;
//
//	}

	

}
